package twitter.Server;

import java.sql.SQLException;


import twitter.TwitterLibrary.*;

import org.apache.log4j.*;

/******************************************************
 * this class is designed for front end server
 * @author fang
 *
 */
public class FrontendServer extends Server{
	static Logger logger=Logger.getLogger(FrontendServer.class);
	

	/****************************************************
	 * Class constructor
	 */
	public FrontendServer()
	{
		super();
	
	
	}
	/**************************************
	 * for running the server and test
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		
		Server test=new FrontendServer();
		if(args.length<2)
		{
			System.out.println("please input the my IP address and my port");
		}
		else
		{
			//SocketConfig.backendServer = args[0];
			//SocketConfig.backendPort = 10001;
			SocketConfig.frontendport = Integer.parseInt(args[1]);
		//SocketConfig.frontendport =9991;
			SocketConfig.myIp=args[0];
			
		//SocketConfig.myIp="localhost";
		test.startServer("connection",SocketConfig.frontendport);
		}
	
	}
/**********************************************
 * start the front end server
 */
	public void startServer(String end,int port) {
		utility.setLogger(logger, "frontend.log");	
		SocketConfig.serverType=ServerType.FrontServer;
		super.startServer(end, port);
	
		
	}

}
